package com.test.cities.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.test.cities.mapper.CommentMapper;
import com.test.cities.po.Comment;
import com.test.cities.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CommentServiceImpl implements CommentService {

    @Autowired
    private CommentMapper commentMapper;

    @Override
    public void saveComment(Comment comment) {
        commentMapper.insert(comment);
    }

    @Override
    public Object listCommentByBlogId(Long blogId) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("blog_id", blogId);
        return commentMapper.selectList(queryWrapper);
    }


}
